<template>
  <el-pagination class="tablePagination tr" :layout="layout" :total="total" :page-size="pageSize" :current-page="pageNum" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</template>

<script>
import { scrollTo } from '@/utils/scroll-to'
export default {
  name: 'PaginationTwo',
  props: {
    total: {
      required: true,
      type: Number
    },
    pageNum: {
      type: Number,
      default: 1
    },
    pageSize: {
      type: Number,
      default: 10
    },
    pageSizes: {
      type: Array,
      default () {
        return [10, 20, 30, 50]
      }
    },
    layout: {
      type: String,
      default: 'slot, prev, pager, next, jumper'
    }
  },
  computed: {
  },
  methods: {
    handleSizeChange (val) {
      this.$emit('paginationFun', val)
      // this.$emit('pagination', { pageNum: this.currentPage, pageSize: val })
      if (this.autoScroll) {
        scrollTo(0, 800)
      }
    },
    handleCurrentChange (val) {
      this.$emit('paginationFun', val)
      if (this.autoScroll) {
        scrollTo(0, 800)
      }
    }
  }
}
</script>

<style>
</style>
